Skip to content

Conversation

@soburi
Copy link
Member

@soburi soburi commented Nov 2, 2025

We will gradually add a Rust compatible API implementation conforming to Apache-2.
This PR adds an alternative implementation of Common.cpp.

@soburi soburi added the DNM This PR should not be merged (Do Not Merge) label Nov 2, 2025
@soburi soburi changed the title rust: Add a Rust compatible API implementation. [DNM] rust: Add a Rust compatible API implementation. Nov 2, 2025
@soburi soburi force-pushed the rust_impl branch 6 times, most recently from 7a556b5 to f86a047 Compare November 2, 2025 19:05
@soburi soburi changed the title [DNM] rust: Add a Rust compatible API implementation. rust: Add a Rust compatible API implementation. Nov 3, 2025
@soburi soburi marked this pull request as ready for review November 3, 2025 01:08
Copy link
Contributor

@pillo79 pillo79 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, looking forward to see this grow! 🥳 🤗

Kconfig Outdated
imply CBPRINTF_FP_SUPPORT
imply RING_BUFFER
select UART_INTERRUPT_DRIVEN
select RUST
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should currently be an optional feature, to avoid adding the strong dependency right away.

run: |
git clone https://github.com/arduino/ArduinoCore-API.git $MODULE_PATH/../ArduinoCore-API
cp -rfp $MODULE_PATH/../ArduinoCore-API/api $MODULE_PATH/cores/arduino/
apt install rustup
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The recommended way to install Rust is via the rustup.rs installer script, Ubuntu's rustup package from apt is often outdated and may not work correctly

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also,
All initialization is lumped into one "Initialize" step mixing unrelated concerns (cloning API, copying files, Rust setup)...
Better structure:

  - name: Clone ArduinoCore-API
[...]
 - name: Install Rust toolchain
[...]

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. Thank you for your comment.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@soburi you didn't address the first comment, why are we not using curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh instead of apt?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I missed it. It was addressed.

rustup target add thumbv6m-none-eabi
rustup target add thumbv7em-none-eabihf
rustup target add thumbv7em-none-eabi
rustup target add thumbv7m-none-eabi
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Installing targets one-by-one is slower. Rustup supports installing multiple targets in one command

rustup target add thumbv6m-none-eabi
rustup target add thumbv7em-none-eabihf
rustup target add thumbv7em-none-eabi
rustup target add thumbv7m-none-eabi
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
rustup target add thumbv7m-none-eabi
rustup target add thumbv6m-none-eabi thumbv7em-none-eabihf thumbv7em-none-eabi thumbv7m-none-eabi

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

We will gradually add a Rust compatible API implementation conforming
to Apache-2.
This PR adds an alternative implementation of Common.cpp.

Signed-off-by: TOKITA Hiroshi <[email protected]>
@soburi soburi force-pushed the rust_impl branch 6 times, most recently from a6ef806 to ba14701 Compare November 22, 2025 02:52
Adding Rust architecture modules for ensure compilation.

Signed-off-by: TOKITA Hiroshi <[email protected]>
@DhruvaG2000
Copy link
Member

@pillo79 can you please take another look if you still have pending comments?

Copy link
Contributor

@pillo79 pillo79 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I might be missing something huge, but... it still seems to me that effectively Rust is being forced on every core use. What is gating the new add_custom_command in the main CMakeLists.txt?

Again, I think it's awesome to see this working 😍, but IMO it should be optional at this stage.


if ARDUINO_API

config USE_ARDUINO_API_RUST_IMPLEMENTATION
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am missing where this symbol is effectively used? AFAICS CMakeLists.txt will try to invoke cargo build regardless of this being set or not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DNM This PR should not be merged (Do Not Merge)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants